package com.ftg.learn.chapter13.lambda.demo;

import com.ftg.learn.chapter12.Student;
import com.ftg.learn.chapter12.isa.animals.Dog;

import java.math.BigDecimal;
import java.util.function.BiFunction;
import java.util.function.LongPredicate;

/**
 * @author kangjx
 * @createTime 2022/8/10
 */
public class WodeYuanSuanClass<T,E,R> {


    public R yuansuan(T x, E y, BiFunction<T,E,R> wd){
        return wd.apply(x,y);
    }

    public static void main(String[] args) {
        WodeYuanSuanClass<Integer,Integer,Integer> wd = new WodeYuanSuanClass<>();

        //对这个接口进行的实现操作  匿名实现类  匿名内部类
        int he = wd.yuansuan(3, 4, (x,y)->x+y);

        System.out.println(he);


        int cha = wd.yuansuan(3, 4, (x,y)->x-y);
        System.out.println(cha);

        int ji = wd.yuansuan(3, 4, (x,y)->x*y);
        System.out.println(ji);


        XiaoFeixingDemo<String> xiaoFeixingDemo = new XiaoFeixingDemo<>();

        xiaoFeixingDemo.xiao(new String[]{"aa","bb","cc"},x-> System.out.println(x));




        XiaoFeixingDemo<Integer> xf1 = new XiaoFeixingDemo<>();
        xf1.xiao(new Integer[]{123,34,67},x-> System.out.println(x));

        GongJiXingDemo<BigDecimal> gongJiXingDemo = new GongJiXingDemo<>();
        System.out.println(gongJiXingDemo.getDemo(() -> new BigDecimal("23")));

        GongJiXingDemo<Dog> d = new GongJiXingDemo<>();
        d.getDemo(()->new Dog());
    }

}
